# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Pierre Neidhardt <ambrevar@gmail.com>
# Contributor: Raymond Wagenmaker <raymondwagenmaker@gmail.com>

pkgname=xss-lock
# It seems that development has stopped but the latest commit is more stable
# than the latest tag.
_commit=1e158fb20108058dbd62bd51d8e8c003c0a48717
_taghash=1e158fb20108
pkgver=0.3.0.g$_taghash
pkgrel=4
pkgdesc="Use external locker as X screen saver"
arch=("loong64" "x86_64")
url="https://bitbucket.org/raymonad/xss-lock"
license=("MIT")
depends=("glib2" "xcb-util")
makedepends=("cmake" "git" "python-docutils")
optdepends=("bash-completion: for bash completion")
# source=("${pkgname}-${pkgver}.tar.gz::https://bitbucket.org/raymonad/$pkgname/get/v$pkgver.tar.gz")
source=("${pkgname}-${pkgver}.tar.gz::https://bitbucket.org/raymonad/xss-lock/get/${_commit}.tar.gz"
				0016-Do-not-core-dump-when-exiting-due-to-loss-of-X-conne.patch)
# source=("git+https://bitbucket.org/raymonad/$pkgname.git")
b2sums=('40ffe8911f37752b13b5d6b0e9eea742f6498b66f9c961635eaa9573f73a75f1b45fe82a956486e93c0f2171288bbcda7c86889661a34ea99303c32a95bd0742'
        'd9bc1e8c8a55bb540106f01620aca318a08e1b662f10b294cb4e6c89dca09e73c389a07402d83bfb1369881cfd78a0bcdb45a0d27785f94ed8428710acb012cb')

prepare() {
	cd raymonad-${pkgname}-${_taghash}
	patch -Np1 < ../0016-Do-not-core-dump-when-exiting-due-to-loss-of-X-conne.patch
}

build() {
	cd raymonad-${pkgname}-${_taghash}
	cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
	make
}

package() {
	cd raymonad-${pkgname}-${_taghash}
	make DESTDIR="${pkgdir}" install
	install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
